<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/commonPage/common.jsp"%>
<!DOCTYPE html>
<html>
<!-- <head>
<meta charset="UTF-8">
<title>后台管理-登录</title>
</head> -->
<head>
<%-- <base id="base" href="${base}"> --%>
<meta charset="UTF-8">
<title>后台管理-登录</title>
<link rel="stylesheet" type="text/css" href="${base }/style/normalize.css" />
<link rel="stylesheet" type="text/css" href="${base }/style/login.css" />
<!--必要样式-->
<link rel="stylesheet" type="text/css" href="${base }/style/component.css" />
</head>
<body>
	<div class="container login">
		<div class="content">
			<div id="large-header" class="large-header">
				<canvas id="login-canvas"></canvas>
				<div class="logo_box">
					<h3>欢迎您</h3>
					<form action="#" name="f" method="post">
						<div class="input_outer">
							<span class="u_user"></span> <input name="username" id="username"
								class="text" style="color: #FFFFFF !important" type="text"
								placeholder="请输入账户">
						</div>
						<div class="input_outer">
							<span class="us_uer"></span> <input name="password" id="password"
								class="text"
								style="color: #FFFFFF !important; position: absolute; z-index: 100;"
								value="" type="password" placeholder="请输入密码">
						</div>
						<div class="mb2">
							<a id="sub" lay-filter="sub" class="act-but submit"
								href="javascript:;" style="color: #FFFFFF">登录</a>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- /container -->
	<script src="${base }/script/TweenLite.min.js"></script>
	<script src="${base }/script/EasePack.min.js"></script>
	<script src="${base }/script/rAF.js"></script>
	<script src="${base }/script/login.js"></script>
</body>
<script>
	$(function() {
		if (window != top) {
			top.location.href = "${base}/admin/login";
		}
	});

	//加载弹出层组件
	layui.use('layer', function() {

		var layer = layui.layer;

		//登录的点击事件
		$("#sub").on("click", function() {
			login();
		})

		$("body").keydown(function() { //实现回车登录
			if (event.keyCode == "13") {
				login();
			}
		})

		//登录函数
		function login() {
			$.ajax({
				type : "post",
				dataType : "json",
				url : '${base}/adminController/loginAction',
				data : {
					username : $("#username").val(),
					password : $("#password").val()
				},
				success : function(data) {
					if (data.result) {
						/*登录成功，跳转首页*/
						window.location = "${base}/admin";
					} else {
						layer.msg("登录失败，请检查用户名或密码！");
					}
				}
			});
		}
	})
</script>
</html>